package org.smile.db.model;

/**
 * 查询过滤参数 
 * 
 * @author strive
 *
 */
public class QueryParam {
	
	public static final String EQUAL="=";
	public static final String LESS="<" ;
	public static final String LARGE=">" ;
	public static final String LESS_EQUAL="<=" ;
	public static final String LARGE_EQUAL=">=" ;
	public static final String UNEQUAL="!=" ;
	public static final String LIKE="LIKE" ;
	public static final String IS_NULL="is null";
	public static final String NOT_NULL="is not null";
	
	/**
	 * 字段
	 */
	private String field;
	/**
	 * 参数 别名 不指定时 默认以field为别名
	 */
	private String param;
	/**
	 * 操作符
	 */
	private String operate;
	/**
	 * 参数值
	 */
	private Object value;
	/**
	 * 
	 */
	public QueryParam(){}
	
	/**
	 * 会指定参数名 ，不以字段做为参数名，
	 * 用于一个字段有多个查询条件  
	 * 如：createDate > oneDate and createDate<twoDate 
	 * 这样就不能以字段createDate做为参数名 而要另指定参数
	 * new QueryParam("createDate",QueryParam.LARGE,oneDate,"oneDate");
	 * @param field
	 * @param operate
	 * @param value
	 * @param param
	 */
	public QueryParam(String field,String operate,Object value,String param){
		this.param=param;
		this.operate=operate;
		this.value=value;
		this.field=field;
	}
	/**
	 * 不指定参数名，默认以字段名为参数名
	 * @param field
	 * @param operate
	 * @param value
	 */
	public QueryParam(String field,String operate,Object value){
		this.field=field;
		this.operate=operate;
		this.value=value;
	}
	/**
	 * 只有字段和操作符  用于is null 和 is not null 
	 * 如:new QueryParam("createDate",QueryParam.IS_NULL);
	 * @param field
	 * @param operate
	 */
	public QueryParam(String field,String operate)
	{
		this.field=field;
		this.operate=operate;
	}
	
	
	
	public String getParam() {
		return param;
	}
	public void setParam(String param) {
		this.param = param;
	}
	public String getOperate() {
		return operate;
	}
	public void setOperate(String operate) {
		this.operate = operate;
	}
	public Object getValue() {
		return value;
	}
	public void setValue(Object value) {
		this.value = value;
	}

	public String getField() {
		return field;
	}

	public void setField(String field) {
		this.field = field;
	}
	
}

